<%@ page import="weaver.general.Util" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    int id = Util.getIntValue( request.getParameter( "id" ) );
%>
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>发货信息</title>
</head>
<body>
<div class="app">
    <label for="shfs">送货方式：</label>
    <select id="shfs">
        <option value="顺丰">顺丰</option>
        <option value="申通">申通</option>
        <option value="圆通">圆通</option>
        <option value="跨越">跨越</option>
        <option value="DHL">DHL</option>
        <option value="其他">其他</option>
        <option value="自行发货">自行发货</option>
    </select>
    <label for="shdh">送货单号：</label><input id="shdh" type="text" value=""/>
    <label for="shsl">送货数量：</label><input id="shsl" type="text" value=""/>
</div>
</body>
</html>
<style>
    * {
        padding: 0;
        margin: 0;
    }

    .app {
        padding-left: 10px;
        display: flex;
        flex-direction: column;
    }
</style>
<script>
    function saveDialog() {
        var id = <%=id%>;
        var shfsid = document.getElementById("shfs");
        var shfs = shfsid.options[shfsid.selectedIndex].value;
        var shdh = document.getElementById("shdh").value;
        var shsl = document.getElementById("shsl").value;
        if (shfs != "" && shdh != "" && shsl != "") {
            editDateAndXgjq(id, shfs, shdh, shsl);
        } else {
            parent.weaJs.alert("发货方式和发货单号以及发货数量不能为空");
        }
    }

    function closeDialog() {
        parent.ModeForm.closeCustomDialog();
    }

    function reloadTable() {
        window.parent.ModeList.reloadTable();
    }

    function editDateAndXgjq(id, shfs, shdh, shsl) {
        window.parent.ecCom.WeaTools.callApi('/interface/temp/sendGoods_Ajax.jsp', 'GET',
            {id: id, shfs: shfs, shdh: shdh, shsl: shsl}, 'json').then(res => {
            if (res.flag) {
                closeDialog();
            }
        });
        window.setTimeout(reloadTable(), 500 );
    }
</script>